/*
 * @Author: your name
 * @Date: 2021-12-09 17:36:13
 * @LastEditTime : 2022-03-25 15:43:12
 * @LastEditors  : Shiming
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath     : \\tms-obc-web\\src\\app\\shared\\components\\imagelist\\imagelist.component.ts
 */
import { Component, Input, OnInit } from '@angular/core';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { NzImageService } from 'ng-zorro-antd/image';
import { NzMessageService } from 'ng-zorro-antd/message';
import { ImageViewComponent } from './imageview/imageview.component';

@Component({
  selector: 'app-imagelist',
  templateUrl: './imagelist.component.html',
  styleUrls: ['./imagelist.less']
})
export class ImageListComponent implements OnInit {
  @Input() imgList: any = [];
  @Input() style = '';
  constructor(
    private modal: ModalHelper,
    public msgSrv: NzMessageService,
    public http: _HttpClient,
    private nzImageService: NzImageService
  ) { }

  ngOnInit(): void {
    this.style = this.style || '';
  }
  showImg(index: any) {
    const params = {
      imgList: this.imgList,
      index
    };
    const images = this.imgList.map((url: string) => {
      if (url) {
        console.log(url);
        ({ src: url })
      }
    });
    this.nzImageService.preview(images);
    // this.modal.create(ImageViewComponent, { params }).subscribe(res => {});
  }
}
